home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / polySelectBorderShell.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.9 KB  |  105 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. global proc polySelectBorderShell(int $borderOnly)
  18. //
  19. // Description:
  20. //        Select either a shell or border based on
  21. //        the current component selection
  22. // Arguments:
  23. //        borderOnly
  24. // Returns:
  25. //
  26. //
  27. {
  28.     string $compSel[]; 
  29.     
  30.     // Process all the subdiv components first
  31.     string $subdComps[];
  32.  
  33.     if (`isTrue "SubdivUIExists"`) {
  34.     
  35.         $subdComps = `subdListComponentConversion -fv -ff -fuv -fe -tuv`;
  36.  
  37.         // Process only one subd component type: UVs, Faces, edges
  38.          $subdComps = `filterExpand -sm 73 $subdComps`;
  39.         if (size($subdComps)) {
  40.     
  41.             // Convert selected subd uvs to shell uvs or border
  42.             if( $borderOnly ) {
  43.                 $subdComps = `subdListComponentConversion -fuv -tuv -uvb $subdComps`;
  44.             } else {
  45.                 $subdComps = `subdListComponentConversion -fuv -tuv -uvs $subdComps`;
  46.             }
  47.         }
  48.     }    // if SubdivUIExists
  49.  
  50.     // Turn on shell mode for current selection. 
  51.     polySelectConstraint -t 0;
  52.     polySelectConstraint -sh 1 -m 2; 
  53.  
  54.     // If want borders filter AFTER getting the entire shell
  55.     if ($borderOnly)
  56.     {
  57.         // // Only do one type. Order of testing is: UVs, Vtx, Face, Edge
  58.          // uv
  59.          $compSel = `filterExpand -sm 35`;
  60.         if (size($compSel))
  61.         {
  62.             polySelectConstraint -w 1 -t 0x0010 -m 2;
  63.             polySelectConstraint -w 0 -t 0x0010 -m 0;
  64.         }
  65.         else
  66.         {
  67.             // Vertex
  68.             $compSel = `filterExpand -sm 31`;
  69.             if (size($compSel))
  70.             {
  71.                 polySelectConstraint -w 1 -t 0x0001 -m 2;
  72.                 polySelectConstraint -w 0 -t 0x0001 -m 0;
  73.             }
  74.             else
  75.             {
  76.                 // edge
  77.                 $compSel = `filterExpand -sm 32`;
  78.                 if (size($compSel))
  79.                 {
  80.                     polySelectConstraint -w 1 -t 0x8000 -m 2;
  81.                     polySelectConstraint -w 0 -t 0x8000 -m 0;
  82.                 }
  83.                 else
  84.                 {
  85.                     // face
  86.                     $compSel = `filterExpand -sm 34`;
  87.                     if (size($compSel))
  88.                     {
  89.                         polySelectConstraint -w 1 -t 0x0008 -m 2;
  90.                         polySelectConstraint -w 0 -t 0x0008 -m 0;
  91.                     }
  92.                 }
  93.             }
  94.         }
  95.     }
  96.  
  97.     // Reset shell constraint
  98.     polySelectConstraint -sh 0 -m 0;
  99.  
  100.     // Add to the selection list the subd components
  101.     if( size($subdComps) > 0 ) {
  102.         select -add $subdComps;
  103.     }
  104. }
  105.